package com.inctech.controller.dataReport;

import java.util.List;

import net.sf.json.JSONObject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.inctech.controller.employee.EmployeeController;
import com.inctech.interceptor.AuthPassport;
import com.inctech.model.SalesInfo;
import com.inctech.service.ISalesInfoService;

@Controller
@RequestMapping("/datareport")
public class DataReportController {
	final Logger logger = LoggerFactory.getLogger(DataReportController.class);

	@Autowired
	private ISalesInfoService saleService;

	@AuthPassport
	@RequestMapping("/dataindex")
	public String index() {
		return "datareport/dataindex";
	}

	@AuthPassport
	@ResponseBody
	@RequestMapping("/forReport")
	public String forReport() {
		JSONObject obj = new JSONObject();
		List<SalesInfo> saleList = saleService.forReport();
		obj.put("row", saleList);
		return obj.toString();
	}
}